package cn.youframe.sample;

import cn.youframe.frame.base.BaseCtrl;
import cn.youframe.frame.beans.TableInfoVO;
import cn.youframe.sample.test.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * User: Administrator
 * DateTime: 13-2-21 下午9:12
 * Desc:
 */
@Controller
@RequestMapping(value = "/sample")
public class PageCtrl extends BaseCtrl{
    @Autowired
    private TestService testService;
    @RequestMapping(value = "/PageCtrl!iframePage.do")
    public String iframePage(HttpServletRequest request){
        request.setAttribute("dataList",testService.getData());
        return "sample/PageWithList";
    }
    @RequestMapping(value = "/PageCtrl!framePage.do")
    public String framePage(HttpServletRequest request){
        Map<String,Object> paramMap=getParamMap(request);
        initEcSide(paramMap,request,10);
        List<TableInfoVO> rslist= testService.getData();
        setTotalRows(rslist,request,10);
        request.setAttribute("dataList",rslist);
        return "sample/PageContent";
    }
}
